﻿/*
 * Created by SharpDevelop.
 * User: IEscarro
 * Date: 9/3/2009
 * Time: 1:09 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using System.Collections.Generic;

namespace Buaya.Model
{
	/// <summary>
	/// Description of TaxCode.
	/// </summary>
	public class TaxCode
	{
		int id;
		IList<TaxSalaryRange> ranges = new List<TaxSalaryRange>();
		
		public virtual IList<TaxSalaryRange> Ranges {
			get { return ranges; }
			set { ranges = value; }
		}
		
		public virtual int Id {
			get { return id; }
			set { id = value; }
		}
		string code;
		
		public virtual string Code {
			get { return code; }
			set { code = value; }
		}
		string description;
		
		public virtual string Description {
			get { return description; }
			set { description = value; }
		}
		double personalExemption;
		
		public virtual double PersonalExemption {
			get { return personalExemption; }
			set { personalExemption = value; }
		}
		bool inactive;
		
		public virtual bool Inactive {
			get { return inactive; }
			set { inactive = value; }
		}
		
		public TaxCode()
		{
		}
		
		public virtual void AddTaxRange(TaxSalaryRange range)
		{
			range.TaxCode = this;
			ranges.Insert(0, range);
			OnTaxRangeAdded(null);
		}
		
		protected virtual void OnTaxRangeAdded(EventArgs e)
		{
			if (TaxRangeAdded != null) {
				TaxRangeAdded(this, e);
			}
		}
		
		public virtual event EventHandler TaxRangeAdded;
	}
}
